/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
var processIds = new Array();

function icon_point(thisFrom) {
    thisFrom.style.cursor = "pointer";
}
function showInfo(thisFrom, oEvent, divName) {
    thisFrom.style.cursor = "pointer";
    var divcal = document.getElementById(divName);
    divcal.style.visibility = "visible";
    var top = oEvent.clientY;
    var left = oEvent.clientX;
    //alert("top:"+top +" left:"+ left);
    divcal.style.top = (top+5);
    divcal.style.left = (left+100);
    var pid = processIds.length;
    var iTimeoutId = setTimeout("hiddenInfo('"+divName+"',"+pid+")", 2000);
    processIds[pid] = iTimeoutId;
}
function hiddenInfo(divName,pid) {
    var divcal = document.getElementById(divName);
    divcal.style.visibility = "hidden";
    clearTimeout(processIds[pid]);
    processIds.slice(pid);
}
function unloading() {
    load_flag = false;
}

function loading() {
    window.blur();
    load_flag = true;
    waiting();
}
function waiting() {
    var divName = "waiting";
    var divcal = document.getElementById(divName);
    divcal.style.cursor = "progress";
    var width =  window.innerWidth;
    var height = window.innerHeight;
    var left = 0;
    var top = 0;
    divcal.style.visibility = "visible";
    divcal.style.cursor = "progress";
    divcal.style.borderStyle = "outset";
    divcal.style.height = height+"px";
    divcal.style.width = width +"px";
    divcal.style.top = left + "px";
    divcal.style.left = top  + "px"
    var pid = processIds.length;
    var iTimeoutId = setTimeout("killLoading('"+divName+"',"+pid+")", 2000);
    processIds[pid] = iTimeoutId;                   
}
function killLoading(divName,pid) {
    var divcal = document.getElementById(divName);
    divcal.style.visibility = "hidden";
    clearTimeout(processIds[pid]);
    processIds.slice(pid);
    if( load_flag == true ) {
        waiting();
    } else {
        var divcal = document.getElementById(divName);
        divcal.style.cursor = "default";
        window.focus();
    }
}

function getText(uiId) {
    return document.getElementById(uiId).value;
}
function getText(uiId,dvalue) {
    var vl = document.getElementById(uiId).value;
    return (vl == null) ? dvalue : vl;
}